package com.bootdo.clouddocms.config;

import com.bootdo.clouddocommon.intercepter.AuthIntercepter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class AuthConfig implements WebMvcConfigurer {
    @Bean
    public AuthIntercepter authIntercepter() {
        return new AuthIntercepter();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
         // 解决前端内容管理 无法访问的问题。by Derek.zhang 20200222
//        InterceptorRegistration addInterceptor = registry.addInterceptor(authIntercepter());
//
//        // 排除配置
//       addInterceptor.excludePathPatterns("/error");
//       addInterceptor.excludePathPatterns("/files/**");
//    //    addInterceptor.excludePathPatterns("/workorder/**");
//
//        // 拦截配置
//       addInterceptor.addPathPatterns("/**");
    }
}
